<template>
  <div class="bigbox">
    <div class="topbox">
      <el-form
        :model="form"
        ref="form"
        label-position="left"
        label-width="80px"
        onsubmit="return false"
      >
        <el-row :gutter="20">
          <el-col :span="5">
            <el-form-item label="用电企业">
              <FilterSelect2
                v-model="bizOrgNo"
                :optionlist="companyList"
                :valuekey="{ name: 'name', value: 'id' }"
                @changeSelect="companyChange"
              ></FilterSelect2>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="产品">
              <FilterSelect2
                v-model="form.productId"
                :optionlist="productList"
                :valuekey="{ name: 'name', value: 'id' }"
                placeholder="请选择产品"
              ></FilterSelect2>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="年度">
              <el-date-picker
                v-model="form.year"
                type="year"
                placeholder="请选择年度"
                style="width: 100%"
                format="yyyy"
                size="small"
                value-format="yyyy"
                :clearable="true"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="9" style="text-align: right">
            <el-form-item>
              <Twobtn @chaxun="chaxun" @chongzhi="chongzhi"></Twobtn>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="bodybox" v-loading="loading">
      <div class="titlebox">
        <div class="text">
          <el-radio-group
            size="small"
            v-model="tabPosition"
            @change="onTabChange"
          >
            <el-radio-button label="month">月度单品能耗</el-radio-button>
            <el-radio-button label="year">年累计单品能耗</el-radio-button>
          </el-radio-group>
        </div>
        <div style="flex: 1; text-align: right; margin-right: 10px">
          <el-button type="primary" size="small" @click="add('add')"
            ><i class="el-icon-plus">按月新增</i></el-button
          >
        </div>
        <TopTile
          @command="command"
          @daochu="daochu"
          @shuaxin="shuaxin"
        ></TopTile>
      </div>
      <div class="table-content">
        <div class="monthly-table-container">
          <table class="monthly-table" v-if="monthlyData">
            <!-- 表头 -->
            <thead>
              <tr>
                <th rowspan="2" class="category-header">每月</th>
                <th colspan="13" class="year-value">
                  {{ (monthlyData && monthlyData.year) || '' }}
                </th>
              </tr>
              <tr>
                <th class="month-header">月</th>
                <th v-for="month in 12" :key="month" class="month-cell">
                  {{ month }}
                </th>
              </tr>
            </thead>
            <!-- 表体 -->
            <tbody>
              <template
                v-for="indicator in (monthlyData && monthlyData.indicators) ||
                []"
              >
                <!-- 指标类型行 -->
                <template v-if="indicator.data && indicator.data.length > 0">
                  <tr
                    v-for="(item, index) in indicator.data"
                    :key="`${indicator.indicatorType}-${item.productId}`"
                  >
                    <td
                      v-if="index === 0"
                      :rowspan="
                        indicator.data.length + (indicator.totalData ? 1 : 0)
                      "
                      class="indicator-type"
                    >
                      <div class="indicator-name">
                        {{ indicator.indicatorType }}
                      </div>
                      <div class="indicator-unit">
                        {{ getIndicatorUnit(indicator.indicatorType) }}
                      </div>
                    </td>
                    <td class="product-name">{{ item.productName }}</td>
                    <td v-for="month in 12" :key="month" class="data-cell">
                      {{ item.monthData[month] || '-' }}
                    </td>
                  </tr>
                </template>
                <!-- 总计行 - 只有当totalData不为null时才显示 -->
                <tr
                  v-if="indicator.totalData"
                  :key="`${indicator.indicatorType}-total`"
                >
                  <td
                    v-if="!indicator.data || indicator.data.length === 0"
                    class="indicator-type"
                  >
                    <div class="indicator-name">
                      {{ indicator.indicatorType }}
                    </div>
                    <div class="indicator-unit">
                      {{ getIndicatorUnit(indicator.indicatorType) }}
                    </div>
                  </td>
                  <td class="total-name">
                    {{
                      (indicator.totalData &&
                        indicator.totalData.productName) ||
                      '-'
                    }}
                  </td>
                  <td
                    v-for="month in 12"
                    :key="month"
                    class="data-cell total-cell"
                  >
                    {{
                      (indicator.totalData &&
                        indicator.totalData.monthData &&
                        indicator.totalData.monthData[month]) ||
                      '-'
                    }}
                  </td>
                </tr>
              </template>
            </tbody>
          </table>
          <div v-else class="no-data">
            <el-empty description="暂无数据"></el-empty>
          </div>
        </div>
      </div>
      <div class="nt-echarts" style="margin-top: 20px">
        <div class="chart-header">
          <div class="product-selector">
            <el-radio-group
              v-model="selectedProductId"
              @change="onProductChange"
            >
              <el-radio
                v-for="product in chartProductList"
                :key="product.productId"
                :label="product.productId"
              >
                {{ product.productName }}
              </el-radio>
            </el-radio-group>
          </div>
        </div>
        <div class="chart-container">
          <nt-echart
            :loading="chartLoading"
            :options="chartOptions"
            style="height: 400px"
          ></nt-echart>
        </div>
      </div>
    </div>
    <div class="dialog">
      <div class="dialog">
        <el-dialog
          title="按月新增"
          :visible.sync="DialogVisible"
          v-if="DialogVisible"
          label-position="left"
          width="500px"
          :destroy-on-close="true"
          :close-on-click-modal="false"
          :before-close="beforeClose"
        >
          <el-form
            :rules="rules"
            ref="form"
            :model="dialogForm"
            label-width="100px"
          >
            <el-form-item label="用电企业" prop="companyId">
              <FilterSelect2
                size="small"
                v-model="dialogForm.companyId"
                :optionlist="companyList"
                :valuekey="{ name: 'name', value: 'id' }"
                @changeSelect="onDialogCompanyChange"
              ></FilterSelect2>
            </el-form-item>
            <el-form-item label="年度" prop="year">
              <el-date-picker
                v-model="dialogForm.year"
                type="year"
                placeholder="请选择年度"
                style="width: 100%"
                format="yyyy"
                value-format="yyyy"
                :clearable="true"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="月份" prop="month">
              <el-select
                v-model="dialogForm.month"
                placeholder="请选择月份"
                style="width: 100%"
              >
                <el-option
                  v-for="month in monthOptions"
                  :key="month.value"
                  :label="month.label"
                  :value="month.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-form>
          <div style="margin-top: 10px; text-align: center">
            <span slot="footer" class="dialog-footer">
              <el-button
                type="primary"
                :loading="generateLoading"
                @click="submit"
              >
                生 成
              </el-button>
            </span>
          </div>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>
import { getCompanyListApi } from '@/api/Configuration-management/index'
import {
  getMonthlyProductConsumptionListApi,
  addMonthlyProductConsumptionApi,
  exportMonthlyProductConsumptionApi,
  getMonthlyProductConsumptionLineApi
} from '@/api/energy-consumption/factory-energy/monthly-product-consumption'
import {
  getYearlyProductConsumptionListApi,
  addYearlyProductConsumptionApi,
  getYearlyProductConsumptionLineApi
} from '@/api/energy-consumption/factory-energy/yearly-product-consumption'
import { getProductListApi } from '@/api/energy-consumption/factory-energy/team-allocation'
import { exportexcel } from '@/utils/excel'
import FilterSelect2 from '@/components/FilterSelect2/index.vue'
import TopTile from '@/components/TopTitle/index.vue'
import Twobtn from '@/components/Twobtn/index.vue'
import ntEchart from '@/components/nt-echart.vue'

export default {
  name: 'TeamAllocation',
  components: {
    FilterSelect2,
    TopTile,
    Twobtn,
    ntEchart
  },
  data() {
    return {
      dataList: [],
      enterpriseCode: '',
      id: '',
      bizOrgNo: '',
      dizhi: '',
      DialogVisible: false,
      form: {
        productId: '',
        year: new Date().getFullYear().toString()
      },
      rules: {
        companyId: [
          { required: true, message: '请选择企业', trigger: 'change' }
        ],
        year: [{ required: true, message: '请选择年度', trigger: 'change' }],
        month: [{ required: true, message: '请选择月份', trigger: 'change' }]
      },
      statusList: [],
      dialogForm: {},
      address: '',
      isshow: false,
      isheight: 72,
      date: [],
      iissize: 'medium',
      loading: false,
      tableData: [],
      total: 0,
      monthlyData: null, // 月度数据
      pageobj: {
        _pageNo: 0,
        _pageSize: 10
      },
      progress: 1,
      addType: '',
      companyData: {},
      companyList: [],
      productList: [], // 产品列表
      monthOptions: [
        // 月份选项
        { label: '1月', value: 1 },
        { label: '2月', value: 2 },
        { label: '3月', value: 3 },
        { label: '4月', value: 4 },
        { label: '5月', value: 5 },
        { label: '6月', value: 6 },
        { label: '7月', value: 7 },
        { label: '8月', value: 8 },
        { label: '9月', value: 9 },
        { label: '10月', value: 10 },
        { label: '11月', value: 11 },
        { label: '12月', value: 12 }
      ],
      // 图表相关数据
      chartProductList: [],
      selectedProductId: null,
      chartLoading: false,
      chartOptions: {},
      // 标签切换
      tabPosition: 'month',
      // 生成按钮加载状态
      generateLoading: false
    }
  },

  async mounted() {
    await this.getCompanyList()
    await this.getProductList()
    await this.getdatalist()
  },
  methods: {
    async companyChange(val) {
      if (val) {
        localStorage.setItem('companyId', val)
        // 切换企业时只重新获取产品列表
        await this.getProductList()
        // 清空产品选择
        this.form.productId = ''
      }
    },
    // 获取用电企业列表
    async getCompanyList() {
      const res = await getCompanyListApi({ companyId: this.bizOrgNo })
      console.log(res)
      this.companyList = res.data.list
      const companyId = +localStorage.getItem('companyId')
      if (companyId && this.companyList.find((i) => i.id == companyId)) {
        this.bizOrgNo = companyId
      } else {
        this.bizOrgNo = this.companyList[0].id
      }
    },
    // 获取产品列表
    async getProductList() {
      try {
        if (!this.bizOrgNo) {
          this.productList = []
          return
        }
        const res = await getProductListApi({
          companyId: this.bizOrgNo
        })
        if (res.code === 200) {
          this.productList = res.data.list || []
        } else {
          this.productList = []
        }
      } catch (error) {
        console.error('获取产品列表失败:', error)
        this.productList = []
      }
    },
    // 初始化
    async getchushihua() {
      this.bizOrgNo = this.companyList[0].id
      // 初始化时获取产品列表
      await this.getProductList()
    },
    // 获取数据
    async getdatalist() {
      this.loading = true
      try {
        let res
        if (this.tabPosition === 'month') {
          res = await getMonthlyProductConsumptionListApi({
            companyId: this.bizOrgNo,
            productId: this.form.productId,
            yearDate: this.form.year
          })
        } else {
          res = await getYearlyProductConsumptionListApi({
            companyId: this.bizOrgNo,
            productId: this.form.productId,
            yearDate: this.form.year
          })
        }

        if (res.code === 200) {
          this.monthlyData = res.data.entity || null
          this.tableData = []
          this.total = 0
        } else {
          this.monthlyData = null
          this.tableData = []
          this.total = 0
        }
      } catch (error) {
        console.error('获取数据失败:', error)
        this.monthlyData = null
        this.tableData = []
        this.total = 0
      }
      this.loading = false
      // 获取图表数据
      await this.getChartData()
    },
    // 分页查询
    currentChange() {
      this.getdatalist()
    },
    // 刷新列表
    shuaxin() {
      this.getdatalist('')
      this.$message({
        type: 'success',
        message: '列表刷新成功',
        duration: 2000
      })
    },
    chaxun() {
      this.getdatalist()
    },
    // 导出
    daochu() {
      const exportUrl =
        this.tabPosition === 'month'
          ? '/ecm-microservice-biz/ecm/monthly/product/consumption/export'
          : '/ecm-microservice-biz/ecm/year/product/consumption/export'
      const exportName =
        this.tabPosition === 'month' ? '月度单品消耗' : '年度单品消耗'

      exportexcel(
        exportUrl,
        {
          companyId: this.bizOrgNo,
          productId: this.form.productId,
          yearDate: this.form.year
        },
        exportName
      )
    },
    command(val) {
      if (val === '默认') {
        this.iissize = 'medium'
      } else if (val === '中等') {
        this.iissize = 'small'
      } else {
        this.iissize = 'mini'
      }
    },
    async submit() {
      await this.$refs.form.validate()
      this.generateLoading = true
      try {
        const data = {
          companyId: this.dialogForm.companyId,
          yearDate: this.dialogForm.year,
          monthDate: this.dialogForm.month.toString()
        }

        let res
        if (this.tabPosition === 'month') {
          res = await addMonthlyProductConsumptionApi(data)
        } else {
          res = await addYearlyProductConsumptionApi(data)
        }

        if (res.code === 200) {
          this.$message({
            type: 'success',
            message: '按月新增成功',
            duration: 2000
          })
          this.getdatalist()
          this.beforeClose()
        } else {
          this.$message({
            type: 'error',
            message: res.message || '按月新增失败',
            duration: 2000
          })
        }
      } catch (error) {
        console.error('保存失败:', error)
        this.$message({
          type: 'error',
          message: '按月新增失败',
          duration: 2000
        })
      } finally {
        this.generateLoading = false
      }
    },
    async chongzhi() {
      await this.getchushihua()
      this.date = []
      this.enterpriseCode = ''
      this.dataList = []
      this.form.productId = ''
      this.form.year = new Date().getFullYear().toString()
      this.getdatalist('')
      // 重新获取产品列表
      await this.getProductList()
    },
    async add() {
      const defaultCompanyId = this.companyList[0].id
      this.$set(this.dialogForm, 'companyId', defaultCompanyId)
      this.$set(this.dialogForm, 'year', new Date().getFullYear().toString())
      this.$set(this.dialogForm, 'month', 1)

      this.DialogVisible = true
    },
    next(progress, id) {
      this.progress = progress
      if (id) {
        this.id = id
      }
    },
    fileData(data) {
      this.companyData = data
      this.dizhi = data.companyAddress
    },
    beforeClose() {
      this.DialogVisible = false
      this.dialogForm = {}
      this.generateLoading = false
    },
    finish() {
      this.centerDialogVisible = false
      this.progress = 1
      this.id = ''
      this.getdatalist('')
    },
    // 弹窗中企业选择变化时的处理
    onDialogCompanyChange(companyId) {
      // 企业选择变化时，可以在这里添加额外的逻辑
      console.log('企业选择变化:', companyId)
    },
    // 标签切换
    onTabChange() {
      // 切换标签时重新获取数据
      this.getdatalist()
    },
    // 获取图表数据
    async getChartData() {
      this.chartLoading = true
      try {
        let res
        if (this.tabPosition === 'month') {
          res = await getMonthlyProductConsumptionLineApi({
            companyId: this.bizOrgNo,
            productId: this.form.productId,
            yearDate: this.form.year
          })
        } else {
          res = await getYearlyProductConsumptionLineApi({
            companyId: this.bizOrgNo,
            productId: this.form.productId,
            yearDate: this.form.year
          })
        }

        if (res.code === 200) {
          this.chartProductList = res.data.list || []
          // 默认选择第一个产品
          if (this.chartProductList.length > 0) {
            this.selectedProductId = this.chartProductList[0].productId
            this.updateChartOptions()
          }
        }
      } catch (error) {
        console.error('获取图表数据失败:', error)
        this.chartProductList = []
      } finally {
        this.chartLoading = false
      }
    },
    // 产品选择变化
    onProductChange(productId) {
      this.selectedProductId = productId
      this.updateChartOptions()
    },
    // 获取指标单位
    getIndicatorUnit(indicatorType) {
      const unitMap = {
        用电: '(kWh)',
        产值: '(万元)',
        单耗: '(kWh/万元)',
        去年同期单耗: '(kWh/万元)'
      }
      return unitMap[indicatorType] || ''
    },
    // 更新图表配置
    updateChartOptions() {
      const selectedProduct = this.chartProductList.find(
        (product) => product.productId === this.selectedProductId
      )

      if (!selectedProduct) {
        this.chartOptions = {}
        return
      }

      // 处理数据
      const electricityData = []
      const outputData = []
      const unitConsumptionData = []
      const months = []

      // 找到用电、产值、单耗的数据
      const electricityItem = selectedProduct.dataLineList.find(
        (item) => item.name === '用电'
      )
      const outputItem = selectedProduct.dataLineList.find(
        (item) => item.name === '产值'
      )
      const unitConsumptionItem = selectedProduct.dataLineList.find(
        (item) => item.name === '单耗'
      )

      // 处理月份数据
      for (let i = 1; i <= 12; i++) {
        months.push(`${i}月`)

        if (electricityItem) {
          const monthData = electricityItem.datalist.find(
            (d) => d.timeReading === i.toString()
          )
          // 电量单位从kWh转换为MWh，除以1000
          electricityData.push(parseFloat(monthData?.valueReading || 0) / 1000)
        } else {
          electricityData.push(0)
        }

        if (outputItem) {
          const monthData = outputItem.datalist.find(
            (d) => d.timeReading === i.toString()
          )
          outputData.push(parseFloat(monthData?.valueReading || 0))
        } else {
          outputData.push(0)
        }

        if (unitConsumptionItem) {
          const monthData = unitConsumptionItem.datalist.find(
            (d) => d.timeReading === i.toString()
          )
          unitConsumptionData.push(parseFloat(monthData?.valueReading || 0))
        } else {
          unitConsumptionData.push(0)
        }
      }

      this.chartOptions = {
        backgroundColor: '#fff',
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross'
          }
        },
        legend: {
          data: ['电量 (MWh)', '产值 (万元)', '单耗 (kWh/万元)'],
          top: 10
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: {
          type: 'category',
          data: months,
          axisPointer: {
            type: 'shadow'
          }
        },
        yAxis: [
          {
            type: 'value',
            name: '电量/产值',
            position: 'left',
            axisLabel: {
              formatter: '{value}'
            }
          },
          {
            type: 'value',
            name: '单耗',
            position: 'right',
            axisLabel: {
              formatter: '{value}'
            }
          }
        ],
        series: [
          {
            name: '电量 (MWh)',
            type: 'bar',
            barGap: 0,
            data: electricityData,
            itemStyle: {
              color: '#5087ec'
            }
          },
          {
            name: '产值 (万元)',
            type: 'bar',
            data: outputData,
            itemStyle: {
              color: '#68bbc4'
            }
          },
          {
            name: '单耗 (kWh/万元)',
            type: 'line',
            yAxisIndex: 1,
            data: unitConsumptionData,
            itemStyle: {
              color: '#58a55c'
            },
            lineStyle: {
              color: '#58a55c',
              type: 'dashed'
            },
            symbol: 'circle',
            symbolSize: 6
          }
        ]
      }
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep .el-select {
  width: 100%;
}
.option {
  height: auto;
}
.dialog-footer {
  display: flex;
  justify-content: center;
}
.bigbox {
  background-color: #f1f1f1;
  padding: 10px;
  height: 100%;
  .topbox {
    background-color: #fff;
    padding: 20px;
    box-sizing: border-box;
    height: 80px !important;
    width: 100% !important;
  }
  .bodybox {
    background-color: #fff;
    margin-top: 10px;
    padding: 20px 20px 20px 20px;
    .titlebox {
      display: flex;
      justify-content: space-between;
      margin-bottom: 10px;
      .text {
        font-weight: bold;
        font-size: 18px;
      }
      .right {
        align-items: center;
        i {
          margin-left: 10px;
        }
      }
    }
    .fenye {
      margin-top: 15px;
      text-align: right;
    }
  }
}

.operate {
  display: flex;
  justify-content: space-around;
}
.dialogBtn {
  width: 80px;
  height: 40px;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
  align-items: center;
}
::v-deep.dialog {
  .el-dialog {
    width: 800px;
    .el-dialog__header {
      padding: 20px 0;
      padding-left: 20px;
      font-size: 14px;
      text-align: left !important;
      border-bottom: 1px solid #f7f7f7;
    }
    .el-dialog__footer {
      margin-top: 50px;
      height: 60px;
    }
  }
}

::v-deep.el-date-editor {
  .el-range-separator {
    line-height: 22px;
  }
}

::v-deep.dialog-content {
  .el-form-item__error {
    margin-top: -8px;
  }
  .el-form-item {
    height: 50px;
    .el-form-item__content {
      width: 90%;
      .el-select {
        width: 100%;
      }
    }
    .el-form-item__label {
      padding: 0;
      padding-right: 10px;
      padding-top: 3px;
      line-height: 32px;
    }
    margin-bottom: 5px;
  }
}
::v-deep.checkbox-item {
  border-top: 1px solid #f7f7f7;
  border-bottom: 1px solid #f7f7f7;
  margin-top: 20px;
  padding: 20px 0;
  .el-form-item {
    .el-form-item__content {
      width: 750px;
    }
  }
  .el-checkbox-group {
    .el-checkbox {
      margin-right: 0;
    }
  }
  .yewufanwei {
    padding-top: 10px;
  }
}

.map {
  padding: 0px;
  margin: 0px;
  width: 100%;
  height: 500px;
}
button {
  cursor: pointer;
}
.top-line {
  display: flex;
  width: 100%;
  height: 80px;
  padding-bottom: 20px;
  margin-bottom: 30px;
  justify-content: space-between;
  line-height: 30px;
  align-items: center;
  border-bottom: 1px solid #bbb;
  .line {
    width: 12%;
    height: 1px;
    border: 1px solid #e0e0e0;
    background: #bbb;
  }
  .top-item {
    display: flex;
    .circle {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      border: 1px solid #bbb;
      color: #bbb;
      text-align: center;
      line-height: 30px;
      margin-right: 10px;
    }
    .text {
      font-weight: 800;
    }
  }
}
.checked-bgc {
  background-color: #1684fc;
  color: #fff !important;
  border: 1px solid #1684fc !important;
}

// 月度表格样式
.monthly-table-container {
  width: 100%;
  overflow-x: auto;

  .monthly-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ddd;
    font-size: 14px;

    th,
    td {
      border: 1px solid #ddd;
      padding: 8px 12px;
      text-align: center;
      vertical-align: middle;
    }

    thead {
      th {
        background-color: #f5f5f5;
        font-weight: bold;
        color: #333;
      }

      .category-header {
        background-color: #f5f5f5;
        width: 80px;
      }

      .year-value {
        background-color: #f5f5f5;
        font-size: 16px;
        font-weight: bold;
      }

      .month-header {
        background-color: #f5f5f5;
        width: 60px;
      }

      .month-cell {
        background-color: #f5f5f5;
        width: 80px;
        font-weight: bold;
      }
    }

    tbody {
      .indicator-type {
        background-color: #f0f9ff;
        font-weight: bold;
        color: #1890ff;
        text-align: center;
        vertical-align: middle;
        text-orientation: mixed;
        width: 60px;
        min-width: 60px;
        padding: 8px 4px;

        .indicator-name {
          font-size: 14px;
          font-weight: bold;
          margin-bottom: 2px;
          color: #1890ff;
        }

        .indicator-unit {
          font-size: 12px;
          font-weight: bold;
          color: #1890ff;
          opacity: 0.9;
        }
      }

      .product-name {
        background-color: #fafafa;
        text-align: left;
        padding-left: 16px;
        font-weight: 500;
        min-width: 120px;
      }

      .total-name {
        background-color: #fff7e6;
        text-align: left;
        padding-left: 16px;
        font-weight: bold;
        color: #fa8c16;
        min-width: 120px;
      }

      .data-cell {
        background-color: #fff;
        min-width: 80px;
        font-family: 'Courier New', monospace;

        &.total-cell {
          background-color: #fff7e6;
          font-weight: bold;
          color: #fa8c16;
        }
      }

      tr:hover {
        .data-cell {
          background-color: #f0f9ff;

          &.total-cell {
            background-color: #fff2e8;
          }
        }
      }
    }
  }

  .no-data {
    text-align: center;
    padding: 40px 0;
  }
}

.nt-echarts {
  margin-top: 20px;
  padding: 20px;

  .chart-header {
    margin-bottom: 20px;

    .product-selector {
      .el-radio-group {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
      }

      .el-radio {
        margin-right: 0;

        ::v-deep .el-radio__label {
          font-size: 14px;
          color: #606266;
        }
      }
    }
  }

  .chart-container {
    width: 100%;
    height: 400px;
  }
}
</style>
